package batframework.log;

import org.apache.log4j.Level;

public class Log4jLogger extends Logger
{
	private org.apache.log4j.Logger log;
	
	private String className;
	
	@Override
	public void initLogger(Class<?> clazz)
	{
		this.className = clazz.getName();
		log = org.apache.log4j.Logger.getLogger(className);
	}

	@Override
	public void initLogger(String clazz)
	{
		this.className = clazz;
		log = org.apache.log4j.Logger.getLogger(className);
	}

	@Override
	public void info(String message)
	{
		log.info(message);
	}

	@Override
	public void info(String message, Throwable t)
	{
		log.info(message, t);
	}

	@Override
	public void debug(String message)
	{
		if(isDebugEnabled())
			log.debug(message);
	}

	@Override
	public void debug(String message, Throwable t)
	{
		if(isDebugEnabled())
			log.debug(message, t);
	}

	@Override
	public void warn(String message)
	{
		log.warn(message);
	}

	@Override
	public void warn(String message, Throwable t)
	{
		log.warn(message, t);
	}

	@Override
	public void error(String message)
	{
		log.error(message);
	}

	@Override
	public void error(String message, Throwable t)
	{
		log.error(message, t);
	}

	@Override
	public void fatal(String message)
	{
		log.fatal(message);
		
	}

	@Override
	public void fatal(String message, Throwable t)
	{
		log.fatal(message,t);
	}

	@Override
	public boolean isDebugEnabled()
	{
		return log.isDebugEnabled();
	}

	@Override
	public boolean isInfoEnabled()
	{
		return log.isInfoEnabled();
	}

	@Override
	public boolean isWarnEnabled()
	{
		return log.isEnabledFor(Level.WARN);
	}

	@Override
	public boolean isErrorEnabled()
	{
		return log.isEnabledFor(Level.ERROR);
	}

	@Override
	public boolean isFatalEnabled()
	{
		return log.isEnabledFor(Level.FATAL);
	}

}
